package com.coderman.tianhua.idgenerator.mysql.mapper;

import com.coderman.tianhua.idgenerator.common.bean.SequenceRule;
import org.apache.ibatis.annotations.Param;

import java.util.List;


public interface SequenceRuleMapper {

    /**
     * 更新
     *
     * @param record
     * @return
     */
    //@UpdateProvider(type = SequenceRuleSQL.class, method = "updateByKey")
    int updateByKey(SequenceRule record);

    /**
     * 新增
     *
     * @param record
     * @return
     */
   // @InsertProvider(type = SequenceRuleSQL.class, method = "insert")
    int insert(SequenceRule record);

    /**
     * 查询指定规则
     *
     * @param key
     * @return
     */
    //@Select("select * from t_sequence_rule where `key`=#{key}")
   //@ResultMap("sequenceRuleDefinitionResults")
    SequenceRule getByKey(@Param("key") String key);

    /**
     * 查询全部规则
     *
     * @return
     */
    //@Select("select * from t_sequence_rule where status=#{status}")
    List<SequenceRule> getByStatus(@Param("status") Byte status);

    /**
     * 分页查询
     *
     * @param key
     * @param status
     * @param row
     * @param pageSize
     * @return
     */
    //@SelectProvider(type = SequenceRuleSQL.class, method = "selectByPage")
    //@ResultMap("sequenceRuleDefinitionResults")
    List<SequenceRule> selectByPage(@Param("key") String key,
                                    @Param("status") Byte status,
                                    @Param("row") long row,
                                    @Param("pageSize") int pageSize);

    /**
     * 查询总数
     *
     * @param key
     * @param status
     * @return
     */
    //@SelectProvider(type = SequenceRuleSQL.class, method = "selectByCount")
    long selectByCount(@Param("key") String key,
                       @Param("status") Byte status);

}